///
/// 张诚宇
///
/// 新闻详情页面
///
/// 2022.6.14
///
///

import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:zhangchengyu20220614/model/NewsMessageEntity.dart';
import 'package:zhangchengyu20220614/model/httputils.dart';

class NewsMessagePage extends StatefulWidget {
  final int newsId;
  const NewsMessagePage({Key key,this.newsId}) : super(key: key);

  @override
  _NewsMessagePageState createState() => _NewsMessagePageState();
}

class _NewsMessagePageState extends State<NewsMessagePage> {

  Result _result;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    NetWorkManaget().netWorkGet('http://mobile.bwstudent.com/hotNews/news/v1/findNewsDetail',map: {'newsId':widget.newsId},onSuccess: (data){
      setState(() {
        _result = NewsMessageEntity.fromJson(data).result;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(

      ),
      body: _result ==null ? Center(child: CircularProgressIndicator(color: Colors.deepOrange,),) : SingleChildScrollView(
        child: Html(
          data: _result.content,
        ),
      ),
    );
  }
}
